<template>
  <a-table :columns="columns" :data-source="bindData" :pagination="false" bordered>
    <template #bodyCell="{ column, record }">
      <template v-if="column.dataIndex === 'origin_category'">
        <span>{{ record.origin_category || '-' }}</span>
        <span v-if="record.origin_sub_category">/{{ record.origin_sub_category }}</span>
      </template>
      <template v-if="column.dataIndex === 'site_category'">
        <span>{{ record.site_category || '-' }}</span>
        <span v-if="record.site_sub_category">/{{ record.site_sub_category }}</span>
      </template>
    </template>
  </a-table>
</template>

<script lang="ts" setup name="ContentQuantityTable">
import { inject } from 'vue'

const bindData = inject('bindData')

const columns = [
  {
    title: '源分类',
    dataIndex: 'origin_category'
  },
  {
    title: '站点分类',
    dataIndex: 'site_category'
  },
  {
    title: '内容源数量',
    dataIndex: 'num'
  }
]
</script>
